#include <iostream>
#include <ctime>
using namespace std;
void test1()
{
	time_t t;
	time(&t);
	/*
	以下代码会出错，因为tm_地址为nullptr，写入会出错
	struct tm* tm_;
	localtime_r(&t,tm_);
	cout<<tm_->tm_year<<endl;
	*/
	struct tm tm_;
	localtime_r(&t,&tm_);
	cout<<tm_.tm_year<<endl;
}
int main()
{
	test1();
	return 0;
}
